home *** CD-ROM | disk | FTP | other *** search
- Descr: Patch certain variables in the kernel to some user-defined
- values. Handles arrays of variables.
- Recompiled for NetBSD 1.1
- Author: Rob Leland, Markus Wild
- Uploader: Rob Leland <leland@freetocreate.cais.com>
-
- The tools/binpatch-arr.tar.gz is a modified version of the binpatch
- array that I made about 2 year ago. Besides the usage outlined
- in the binpatch.readme file, it allows patching of arrays of variables
-
- A man page can be had by typeing binpatch -HELP.
- A synopsis can gleamed by just typing binpatch.
-
- -Rob leland@freetocreate.cais.com
-
- ---------------------------------------------------------------------------
- binpatch -HELP:
- ~~~~~~~~~~~~~~
-
- NAME
- ./binpatch.bsdexe - Allows the patching of BSD binaries
- SYNOPSIS
- ./binpatch.bsdexe [-HELP]
- ./binpatch.bsdexe [-b|-w|-l] -s symbol[[[index]][=value]] binary
- ./binpatch.bsdexe [-b|-w|-l] [-o offset] -s symbol [-r value] binary
- ./binpatch.bsdexe [-b|-w|-l] [-o offset] -a address [-r value] binary
- DESCRIPTION
- Allows the patching of BSD binaries, for example,a distributed
- kernel. Recient additions allows the user to index into an array
- and assign a value. Binpatch has internal variables to allow
- you to test it on itself under NetBSD.
- OPTIONS
- -a patch variable by specifying address in hex
- -b symbol or address to be patched is 1 byte
- -l symbol or address to be patched is 4 bytes (default)
- -o offset to begin patching value relative to symbol or address
- -r replace value, and print out previous value to stdout
- -s patch variable by specifying symbol name. Use '[]'
- to specify the 'index'. If '-b, -w or -l' not specified
- then index value is used like an offset. Also can use '='
- to assign value
- -w symbol or address to be patched is 2 bytes
- EXAMPLES
- This should print 100 (this is a nice reality check...)
- binpatch -l -s _hz vmunix
- Now it gets more advanced, replace the value:
- binpatch -l -s _scsi_debug -r 1 vmunix
- Now patch a variable at a given 'index' not offset,
- under NetBSD you must use '', under AmigaDos CLI '' is optional.:
- binpatch -w -s '_vieww[4]' -r 0 a.out
- same as
- binpatch -w -o 8 -s _vieww -r 0 a.out
- Another example of using []
- binpatch -s '_viewl[4]' -r 0 a.out
- same as
- binpatch -o 4 -s _viewl -r 0 a.out
- One last example using '=' and []
- binpatch -w -s '_vieww[4]=2' a.out
- So if the kernel is not finding your drives, you could enable
- all available debugging options, helping to shed light on that problem.
- binpatch -l -s _scsi_debug -r 1 vmunix scsi-level
- binpatch -l -s _sddebug -r 1 vmunix sd-level (disk-driver)
- binpatch -l -s _acdebug -r 1 vmunix autoconfig-level
- SEE ALSO
- binpatch.c binpatch(1)
-
-
-
-
- binpatch.readme:
- ~~~~~~~~~~~~~~~~
- The binpatch utility allows you to patch your BSD binaries, for example,
- a distributed kernel. There's no man-page for it currently, these may
- serve as example, to go into details, read the source:
-
- binpatch -l -s _hz vmunix
- | | |
- ^^^ | ^^^
- a long | symbol name, "_hz" in this case
- ^^^
- you specify symbol (-a to specify address)
-
- this should print 100 (this is a nice reality check...)
-
- Other sizes available are -w: 2 byte, -b: 1 byte.
-
- now it gets more advanced:
- binpatch -l -s _scsi_debug -r 1 vmunix
-
- -r 1 says, replace the value found with 1. The previous value is printed
- to stdout, and the new value is set.
-
- So if you have problems with the kernel not finding your
- drives, you could enable all available debugging options helping to
- shed light on that problem:
-
- binpatch -l -s _scsi_debug -r 1 vmunix scsi-level
- binpatch -l -s _sddebug -r 1 vmunix sd-level (disk-driver)
- binpatch -l -s _acdebug -r 1 vmunix autoconfig-level
-
- Good luck!
-
- -Markus Wild
-
- PS: compile with gcc -I. binpatch.c nlist.c -o binpatch.
-